package com.njtoyo.taxi.admin.logic.geo;

import com.njtoyo.taxi.admin.mapper.master.mapper.GeoCantonAreaMapper;
import com.njtoyo.taxi.admin.rest.wrapper.business.canton.CantonAreaCreateWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
@Slf4j
public class CantonAreaLogic {
    @Autowired
    private GeoCantonAreaMapper geoCantonAreaMapper;

    public void createInsert(Long cantonId, List<Long> areaIds) {
        List<CantonAreaCreateWrapper> list = new ArrayList<>();
        for (Long areaId : areaIds) {
            CantonAreaCreateWrapper item = new CantonAreaCreateWrapper();
            item.setCantonId(cantonId);
            item.setAreaId(areaId);
            list.add(item);
        }

        geoCantonAreaMapper.createBatch(list);
    }
}
